package com.neu.icloud.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.neu.icloud.entity.Plan;

@Mapper
public interface PlanMapper {

	//查询计划
	@Select("select planId,planName,orderId,productName,planMount,deliveryDate,planBeginDate,planEndDate,factoryId,planState from plan")
	public List<Plan> listPlan();
	
	//根据计划状态查询
	@Select("select * from plan where planState=#{planState}")
	public List<Plan> listPlanByState(String planState);
	
	//根据id查询
	@Select("select * from plan where orderId=#{orderId}")
	public List<Plan> listPlanById(Integer orderId);
	
	@Select("select productName from plan where planId=#{planId}")
	//查询产品名称
	public String selectByPlanId(Integer planId);
	
	//增加计划
	public int savePlan(Plan plan);
	
	//启动计划
	public int updatePlan(Plan plan);
	
	//删除计划
	@Delete("delete from plan where planId=#{planId}")
	public int removePlan(Integer planId);
	
	//修改计划状态
	@Update("update plan set planState='已完成' where planId=#{planId}")
	public int updatePlanState(Integer planId);
}

